import { createRouter, createWebHashHistory, createWebHistory } from "vue-router";
import Home from "../views/Home/index.vue";

export const routes = [
    {
        path: "/home",
        name: "home",
        // redirect: Home,
        components: {
            default: Home,
        },
        meta: {
            title: "首页",
            isHidden: false,  //导航是否隐藏

            //isHidden: true,/*导航隐藏*/
        },
    },
    {
        path: "/friend",
        name: "friend",
        components: {
            default: () => import("../views/Friend/index.vue"),
        },
        meta: {
            title: "书友",
            isHidden: false, //导航是否隐藏

        },
    },
    {
        path: "/regi",
        name: "regi",
        components: {
            default: () => import("../views/Friend/regi.vue"),
        },
        meta: {
            title: "最多注册",
            isHidden: false, //导航是否隐藏
        },
    },
    {
        path: "/booksear",
        name: "booksear",
        components: {
            default: () => import("../views/Booksear/index.vue"),
        },
        meta: {
            title: "书友搜索",
            isHidden: false, //导航是否隐藏

        },
    },
    {
        path: "/sell",
        name: "sell",
        components: {
            default: () => import("../views/Sell/index.vue"),
        },
        meta: {
            title: "卖书",
            isHidden: false, //导航是否隐藏

        },
    },
    {
        path: "/school", //控制
        components: {
            default: () => import("../views/Sell/school.vue"),
        },
        name: "school",
        meta: {
            title: "设置学校",
            isHidden: true,
        },
    },
    {
        path: "/examine", //控制
        components: {
            default: () => import("../views/Examine/index.vue"),
        },
        name: "examine",
        meta: {
            title: "审核规则",
            isHidden: true,
        },
    },
    {
        path: "/batch",
        name: "batch",
        components: {
            default: () => import("../views/Batch/index.vue"),
        },
        meta: {
            title: "批量",
        },
    },
    {
        path: "/news",
        name: "news",
        components: {
            default: () => import("../views/News/index.vue"),
        },
        meta: {
            title: "消息",
        },
    },
    {
        path: "/detail",
        name: "detail",
        components: {
            default: () => import("../views/Detail/index.vue"),
        },
        meta: {
            title: "卖书详情",
        },
    },
    {
        path: "/me",
        name: "me",
        components: {
            default: () => import("../views/Me/index.vue"),
        },
        meta: {
            title: "我的",
        },
    },
    {
        path: "/search",
        name: "search",
        components: {
            default: () => import("../views/Search/index.vue"),
        },
        meta: {
            title: "搜索",
            //导航栏隐藏
            isHidden: true
        },
    },
    {
        path: "/more",
        name: "more",
        components: {
            default: () => import("../views/More/index.vue"),
        },
        meta: {
            title: "更多",
            //导航栏隐藏
            isHidden: true
        },
    },
    {
        path: "/stop",
        name: "stop",
        components: {
            default: () => import("../views/Stop/index.vue"),
        },
        meta: {
            title: "购物车",
            //导航栏隐藏
            isHidden: true
        },
    },

    {
        path: "/me",
        name: "me",
        components: {
            default: () => import("../views/Me/index.vue"),
        },
        meta: {
            title: "我的",
        },
    },
    {
        path: "/buycar",
        name: "buycar",
        components: {
            default: () => import("../views/BuyCar/index.vue"),
        },
        meta: {
            title: "购物车",
            isHidden: true
        },
    },
    {
        path: "/purchase",
        name: "purchase",
        components: {
            default: () => import("../views/Purchase/index.vue"),
        },
        meta: {
            title: "买的订单",
            isHidden: true
        },
    },
    {
        path: "/orders",
        name: "orders",
        components: {
            default: () => import("../views/Orders/index.vue"),
        },
        meta: {
            title: "卖的订单",
            isHidden: true
        },
    },
    {
        path: "/orderbook",
        name: "orderbook",
        components: {
            default: () => import("../views/OrderBook/index.vue"),
        },
        meta: {
            title: "售书架",
            isHidden: true
        },
    },
    {
        path: "/balance",
        name: "balance",
        components: {
            default: () => import("../views/Balance/index.vue"),
        },
        meta: {
            title: "余额",
            isHidden: true
        },
    },
    {
        path: "/integral",
        name: "integral",
        components: {
            default: () => import("../views/Integral/index.vue"),
        },
        meta: {
            title: "积分",
            isHidden: true
        },
    },
    {
        path: "/fans",
        name: "fans",
        components: {
            default: () => import("../views/Fans/index.vue"),
        },
        meta: {
            title: "粉丝",
            isHidden: true
        },
    },
    {
        path: "/concern",
        name: "concern",
        components: {
            default: () => import("../views/Concern/index.vue"),
        },
        meta: {
            title: "关注",
            isHidden: true
        },
    },
    {
        path: "/set",
        name: "set",
        components: {
            default: () => import("../views/Set/index.vue"),
        },
        meta: {
            title: "设置",
            isHidden: true
        },
    },
    {
        path: "/help",
        name: "help",
        components: {
            default: () => import("../views/Help/index.vue"),
        },
        meta: {
            title: "帮助",
            isHidden: true
        },
    },
    {
        path: "/userset",
        name: "userset",
        components: {
            default: () => import("../views/UserSet/index.vue"),
        },
        meta: {
            title: "个人设置",
            isHidden: true
        },
    },
    {
        path: "/sellerset",
        name: "sellerset",
        components: {
            default: () => import("../views/SellerSet/index.vue"),
        },
        meta: {
            title: "卖家设置",
            isHidden: true
        },
    },
    {
        path: '/details/:idbook',
        name: "details",
        components: {
            default: () => import("../views/Details/index.vue"),
        },
        meta: {
            title: "详情",
            isHidden: false,

        },
    },
    {
        path: "/sale/:idbook",
        name: "sale",
        components: {
            default: () => import("../views/Sale/index.vue"),
        },
        meta: {
            title: "畅销",
            isHidden: false
        },
    },
    {
        path: "/more",
        name: "more",
        components: {
            default: () => import("../views/More/index.vue"),
        },
        meta: {
            title: "更多",
            isHidden: true
        },
    },
    {
        path: "/login",
        name: "login",
        components: {
            default: () => import("../views/Login/index.vue"),
        },
        meta: {
            title: "登录",
            isHidden: true
        },
    },
    {
        path: "/logon",
        name: "logon",
        components: {
            default: () => import("../views/Logon/index.vue"),
        },
        meta: {
            title: "注册",
            isHidden: true
        },
    },
    {
        path: "/hot/:blId",
        name: "hot",
        components: {
            default: () => import("../views/Hot/index.vue"),
        },
        meta: {
            title: "热门书单",
            isHidden: false
        },
    },
    // 重定向就这么写，固定的
    {
        path: '/',
        redirect: "/home",
        meta: {
            isHidden: true,
        }
    }
];
const router = createRouter({
    history: createWebHistory(),
    routes,
});
export default router;